<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="messages.aspx.cs" Inherits="messages" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="css/YahooGridView.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div style="background-color:#CCCCFF; width:800px; text-align:center; margin-left:auto; margin-right:auto; padding:5px; margin-top:5px;">
        <asp:TextBox ID="tbSearch" runat="server" Width="300px" Visible="false" />
        <ajax:TextBoxWatermarkExtender ID="weSearch" runat="server" TargetControlID="tbSearch" WatermarkText="search by name or number" />
        <asp:Button ID="btSearch" runat="server" Text="Search" OnClick="btSearch_Click" Visible="false" />
        <asp:CheckBox ID="cbActiveOnly" runat="server" Text="Active Only" Checked="true" AutoPostBack="true" OnCheckedChanged="cbActiveOnly_CheckedChanged" />
    </div>
    <div style="background-color:#CCCCFF; width:800px; margin-left:auto; margin-right:auto; padding:5px; margin-top:5px;">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td valign="top" style="width:50%">
                        <asp:GridView ID="gvMessages" runat="server" AutoGenerateColumns="False" DataKeyNames="MessageID" OnRowCommand="gvMessages_RowCommand" 
                            OnRowCreated="gvMessages_RowCreated" OnSelectedIndexChanging="gvMessages_SelectedIndexChanging" OnDataBinding="dataBinding" Width="100%" 
                            AllowPaging="true" PageIndex="25">
                            <HeaderStyle CssClass="HeaderStyle" />
                            <RowStyle CssClass="RowStyle" />
                            <SelectedRowStyle CssClass="SelectedRowStyle" />
                            <Columns>
                                <asp:CommandField ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/images/rt.gif" />
                                <asp:TemplateField HeaderText="Client">
                                    <ItemTemplate>
                                        <asp:Label ID="lbClientName" runat="server" Text='<%# Eval("Call.Event.Client.Name") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Timestamp" HeaderText="Taken" SortExpression="Timestamp" />
                                <asp:BoundField DataField="CallerName" HeaderText="Caller" SortExpression="CallerName" />
                                <asp:CheckBoxField DataField="Active" HeaderText="Active" SortExpression="Active" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField ShowHeader="false" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btChangeActive" runat="server" Text="X" CommandName="change"  />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                </td>
                <td valign="top" style="width:50%">
                        <asp:DetailsView ID="dvMessages" runat="server" AutoGenerateRows="False" DataKeyNames="MessageID" 
                            OnDataBound="dvMessages_DataBound" OnDataBinding="dataBinding" Width="100%" OnLoad="dvMessages_Load">
                            <FieldHeaderStyle CssClass="HeaderStyle" />
                            <RowStyle CssClass="RowStyle" />
                            <Fields>
                                <asp:BoundField DataField="Timestamp" HeaderText="Timestamp" SortExpression="Timestamp" />
                                <asp:BoundField DataField="CallerName" HeaderText="CallerName" SortExpression="CallerName" />
                                <asp:BoundField DataField="CallerAddress" HeaderText="CallerAddress" SortExpression="CallerAddress" />
                                <asp:BoundField DataField="CallerNumber" HeaderText="CallerNumber" SortExpression="CallerNumber" />
                                <asp:BoundField DataField="CallerExt" HeaderText="CallerExt" SortExpression="CallerExt" />
                                <asp:BoundField DataField="Text" HeaderText="Text" SortExpression="Text" />
                                <asp:BoundField DataField="CustomText1_Label" HeaderText="CustomText1_Label" SortExpression="CustomText1_Label" />
                                <asp:BoundField DataField="CustomText1" HeaderText="CustomText1" SortExpression="CustomText1" />
                                <asp:BoundField DataField="CustomText2_Label" HeaderText="CustomText2_Label" SortExpression="CustomText2_Label" />
                                <asp:BoundField DataField="CustomText2" HeaderText="CustomText2" SortExpression="CustomText2" />
                                <asp:BoundField DataField="CustomText3_Label" HeaderText="CustomText3_Label" SortExpression="CustomText3_Label" />
                                <asp:BoundField DataField="CustomText3" HeaderText="CustomText3" SortExpression="CustomText3" />
                                <asp:BoundField DataField="CustomDateTime1_Label" HeaderText="CustomDateTime1_Label" SortExpression="CustomDateTime1_Label" />
                                <asp:BoundField DataField="CustomDateTime1" HeaderText="CustomDateTime1" SortExpression="CustomDateTime1" />
                                <asp:BoundField DataField="CustomDateTime2_Label" HeaderText="CustomDateTime2_Label" SortExpression="CustomDateTime2_Label" />
                                <asp:BoundField DataField="CustomDateTime2" HeaderText="CustomDateTime2" SortExpression="CustomDateTime2" />
                                <asp:BoundField DataField="CustomDateTime3_Label" HeaderText="CustomDateTime3_Label" SortExpression="CustomDateTime3_Label" />
                                <asp:BoundField DataField="CustomDateTime3" HeaderText="CustomDateTime3" SortExpression="CustomDateTime3" />
                                <asp:BoundField DataField="CustomNumeric1_Label" HeaderText="CustomNumeric1_Label" SortExpression="CustomNumeric1_Label" />
                                <asp:BoundField DataField="CustomNumeric1" HeaderText="CustomNumeric1" SortExpression="CustomNumeric1" />
                                <asp:BoundField DataField="CustomNumeric2_Label" HeaderText="CustomNumeric2_Label" SortExpression="CustomNumeric2_Label" />
                                <asp:BoundField DataField="CustomNumeric2" HeaderText="CustomNumeric2" SortExpression="CustomNumeric2" />
                                <asp:BoundField DataField="CustomNumeric3_Label" HeaderText="CustomNumeric3_Label" SortExpression="CustomNumeric3_Label" />
                                <asp:BoundField DataField="CustomNumeric3" HeaderText="CustomNumeric3" SortExpression="CustomNumeric3" />
                                <asp:BoundField DataField="CustomBit1_Label" HeaderText="CustomBit1_Label" SortExpression="CustomBit1_Label" />
                                <asp:CheckBoxField DataField="CustomBit1" HeaderText="CustomBit1" SortExpression="CustomBit1" />
                                <asp:BoundField DataField="CustomBit2_Label" HeaderText="CustomBit2_Label" SortExpression="CustomBit2_Label" />
                                <asp:CheckBoxField DataField="CustomBit2" HeaderText="CustomBit2" SortExpression="CustomBit2" />
                                <asp:BoundField DataField="CustomBit3_Label" HeaderText="CustomBit3_Label" SortExpression="CustomBit3_Label" />
                                <asp:CheckBoxField DataField="CustomBit3" HeaderText="CustomBit3" SortExpression="CustomBit3" />
                            </Fields>
                        </asp:DetailsView>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>

